package
{
	import flash.events.ProgressEvent;
	import flash.net.URLRequest;
	import flash.net.URLStream;
	
	import root.TestRoot;
	
	public class LoadStream extends TestRoot
	{
		private	var	_loadStream:URLStream = null;
		
		public function LoadStream()
		{
			super();
			this._loadStream = new URLStream();
			var req:URLRequest = new URLRequest("http://localhost/test.html");
			this._loadStream.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
			this._loadStream.load(req);
		}
		
		public	function	onLoadProgress(evt:ProgressEvent):void{
//			if (this._loadStream.bytesAvailable > 0){
//				trace("read byte:"+this._loadStream.readByte());
//			}
			trace("loaded:"+evt.bytesLoaded+",total:"+evt.bytesTotal
				+",per:"+evt.bytesLoaded/evt.bytesTotal);
		}
	}
}